<template>
  <div>
    <h1>{{ userid }}</h1>
    <h1>{{ stu1.name }}</h1>
    <h2 v-for="i in stu1.nj">{{ i.name }}</h2>
    <button @click="jump">升级</button>

  </div>
</template>

<script>
export default {
  name: "dianji",
  data() {
    return {
      userid: localStorage.getItem('userid'),
      suser: {},
      stu: {},
      stu1: {}


    }

  },
  methods: {
    get_user() {
      this.$axios.get('suser/?id=' + this.userid)
        .then(res => {
          this.suser = res.data.list
        })
    },

    get_stu1() {
      this.$axios.get('nian/?id=' + this.userid)
        .then(res => {
          this.stu1 = res.data.list
        })
    },
    jump() {
      this.$axios.put('stu/?id=' + this.userid)
        .then(res => {
          if (res.data.code == 200) {
            alert('升班成功')

          }
        })
    }
  },
  mounted() {
    this.get_user()
    this.get_stu1()
  }

}
</script>

<style scoped>

</style>
